#ifndef _GV_H_
#define _GV_H_

#define _AFXDLL
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <string>
#include <fcntl.h>
#include <errno.h>
#include <map>
#include <time.h>
#include <afx.h>
#include <odbcinst.h>
#include <afxdb.h>
#include <io.h>
#include "stdafx.h"

using namespace std;
using namespace System;

#define HRCOMHEADER_COUNT 6
#define HRCOMHEADER_SIZE (sizeof(int) * 6)
#define HRCOMHEADER_OFFSET 0
#define REF_PRICE_SIZE sizeof(float)
#define SAVE_BIN_ALL_SQL "SELECT VALUE FROM SIMULATIONCONTROL WHERE NAME='Save All To Binary'"


class reader
    {
	protected:

		int date[HRCOMHEADER_COUNT];
		int getSimHours();
		CString sDriver;
		CString sDsn;
		CString sFile;
		CString SqlString;
		BOOL openFile(char* fileName);
		BOOL closeFile();
		void readDateInfo();

    public:

		int simHours;
		int file_Handle;
		CDatabase db;
        reader();
		int saveBinAll;
		reader(char *binFile, char *dbFile);
		int getSimStartYear() { return date[0]; }
		int getSimStartMonth(){ return date[1]; }
		int getSimStartDay(){ return date[2]; }
		int getSimEndYear(){ return date[3]; }
		int getSimEndMonth(){ return date[4]; }
		int getSimEndDay(){ return date[5]; }
		float get_offset_value(unsigned long offset);
		~reader();
    };


#endif //#define _GV_H_